import { SlabThicknessSlider } from '@ohif/ui';
import { TOOLBAR_BUTTON_TYPES } from '@ohif/core';
import { DEFAULT_CONTEXT } from './config';

const definitions = [
  {
    id: "MPRLayout",
    label: "MPR Layout",
    icon: 'series-layout',
    className: 'hideOnPhone',
    buttons: [
      {
        id: 'MPR-L1+R1',
        label: 'L1 + R2',
        icon: 'layout-L1+R2',
        type: TOOLBAR_BUTTON_TYPES.STATE,
        commandName: 'setMPRLayout',
        commandOptions: { numRows: 2, numColumns: 2, merge: 'L' },
        options: {
          keys: [
            'viewports.numRows',
            'viewports.numColumns',
            'viewports.merge',
          ],
          values: [2, 2, 'L'],
        }
      },
      {
        id: 'MPR-L2+R1',
        label: 'L2 + R1',
        icon: 'layout-L2+R1',
        type: TOOLBAR_BUTTON_TYPES.STATE,
        commandName: 'setMPRLayout',
        commandOptions: { numRows: 2, numColumns: 2, merge: 'R' },
        options: {
          keys: [
            'viewports.numRows',
            'viewports.numColumns',
            'viewports.merge',
          ],
          values: [2, 2, 'R'],
        }
      },
      {
        id: 'MPR-T1+B2',
        label: 'T1 + B2',
        icon: 'layout-T1+B2',
        type: TOOLBAR_BUTTON_TYPES.STATE,
        commandName: 'setMPRLayout',
        commandOptions: { numRows: 2, numColumns: 2, merge: 'T' },
        options: {
          keys: [
            'viewports.numRows',
            'viewports.numColumns',
            'viewports.merge',
          ],
          values: [2, 2, 'T'],
        }
      },
      {
        id: 'MPR-T2+B1',
        label: 'T2 + B1',
        icon: 'layout-T2+B1',
        type: TOOLBAR_BUTTON_TYPES.STATE,
        commandName: 'setMPRLayout',
        commandOptions: { numRows: 2, numColumns: 2, merge: 'B' },
        options: {
          keys: [
            'viewports.numRows',
            'viewports.numColumns',
            'viewports.merge',
          ],
          values: [2, 2, 'B'],
        }
      },
      {
        id: 'MPR-1X3',
        label: '1 X 3',
        icon: 'layout-1x3',
        type: TOOLBAR_BUTTON_TYPES.STATE,
        commandName: 'setMPRLayout',
        commandOptions: { numRows: 1, numColumns: 3 },
        options: {
          keys: [
            'viewports.numRows',
            'viewports.numColumns',
          ],
          values: [1, 3],
        }
      },
      {
        id: 'MPR-3X1',
        label: '3 X 1',
        icon: 'layout-3x1',
        type: TOOLBAR_BUTTON_TYPES.STATE,
        commandName: 'setMPRLayout',
        commandOptions: { numRows: 3, numColumns: 1 },
        options: {
          keys: [
            'viewports.numRows',
            'viewports.numColumns',
          ],
          values: [3, 1],
        }
      },
    ],
  },
  {
    id: 'Crosshairs',
    label: 'Crosshairs',
    icon: 'crosshairs',
    className: 'hideOnPhone',
    type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
    commandName: 'enableCrosshairsTool',
    commandOptions: {},
  },
  {
    id: 'WWWC',
    label: 'WWWC',
    icon: 'contrast',
    className: 'hideOnPhone',
    type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
    commandName: 'enableLevelTool',
    commandOptions: {},
  },
  {
    id: 'Rotate',
    label: 'Rotate',
    icon: 'rotate3d',
    className: 'hideOnPhone',
    type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
    commandName: 'enableRotateTool',
    commandOptions: {},
  },
  {
    id: 'Reset',
    label: 'Reset',
    icon: 'reset',
    className: 'hideOnPhone',
    type: TOOLBAR_BUTTON_TYPES.COMMAND,
    commandName: 'resetMPR',
  },
  {
    id: 'MPRTools',
    label: "Tools",
    icon: 'crosshairs',
    className: 'hideOnDesktop',
    buttons: [
      {
        id: 'Crosshairs',
        label: 'Crosshairs',
        icon: 'crosshairs',
        //
        type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
        commandName: 'enableCrosshairsTool',
        commandOptions: {},
      },
      {
        id: 'WWWC',
        label: 'WWWC',
        icon: 'contrast',
        //
        type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
        commandName: 'enableLevelTool',
        commandOptions: {},
      },
      {
        id: 'Rotate',
        label: 'Rotate',
        icon: 'rotate3d',
        //
        type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
        commandName: 'enableRotateTool',
        commandOptions: {},
      },
      {
        id: 'Reset',
        label: 'Reset',
        icon: 'reset',
        //
        type: TOOLBAR_BUTTON_TYPES.COMMAND,
        commandName: 'resetMPR',
      },
    ]
  },

  {
    id: 'MPR',
    label: 'MPR',
    icon: 'blend-com',
    className: 'hideOnPhone',
    type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
    commandName: 'setBlendModeToComposite',
    options: {
      isVtkMpr: true,
      showSlabThickness: false,
    },
  },
  {
    id: 'MaxIP',
    label: 'MaxIP',
    icon: 'blend-max',
    className: 'hideOnPhone',
    type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
    commandName: 'setBlendModeToMaximumIntensity',
    options: {
      isVtkMpr: true,
      showSlabThickness: true,
    },
  },
  {
    id: 'MinIP',
    label: 'MinIP',
    icon: 'blend-min',
    className: 'hideOnPhone',
    type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
    commandName: 'setBlendModeToMinimumIntensity',
    options: {
      isVtkMpr: true,
      showSlabThickness: true,
    },
  },
  {
    id: 'AvgIP',
    label: 'AvgIP',
    icon: 'blend-avg',
    className: 'hideOnPhone',
    type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
    commandName: 'setBlendModeToAverageIntensity',
    options: {
      isVtkMpr: true,
      showSlabThickness: true,
    },
  },
  {
    id: "BlendMode",
    label: "Blend Mode",
    icon: 'blend-com',
    className: 'hideOnDesktop',
    buttons: [
      {
        id: 'MPR',
        label: 'MPR',
        icon: 'blend-com',
        //
        type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
        commandName: 'setBlendModeToComposite',
        options: {
          isVtkMpr: true,
          showSlabThickness: false,
        },
      },
      {
        id: 'MaxIP',
        label: 'MaxIP',
        icon: 'blend-max',
        //
        type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
        commandName: 'setBlendModeToMaximumIntensity',
        options: {
          isVtkMpr: true,
          showSlabThickness: true,
        },
      },
      {
        id: 'MinIP',
        label: 'MinIP',
        icon: 'blend-min',
        //
        type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
        commandName: 'setBlendModeToMinimumIntensity',
        options: {
          isVtkMpr: true,
          showSlabThickness: true,
        },
      },
      {
        id: 'AvgIP',
        label: 'AvgIP',
        icon: 'blend-avg',
        //
        type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
        commandName: 'setBlendModeToAverageIntensity',
        options: {
          isVtkMpr: true,
          showSlabThickness: true,
        },
      },
    ]
  },
  {
    id: 'changeSlabThickness',
    label: 'Slab Thickness',
    CustomComponent: SlabThicknessSlider,
    commandName: 'setSlabThickness',
    commandOptions: {},
  },
  {
    id: 'ExitMPR',
    label: 'Exit',
    icon: 'exit',
    // className: 'hideOnPhone',
    type: TOOLBAR_BUTTON_TYPES.COMMAND,
    commandName: 'setCornerstoneLayout',
  },
];

export default {
  definitions,
  defaultContext: DEFAULT_CONTEXT,
};
